# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>

pkgname=dump_syms
pkgver=2.2.1
pkgrel=1
pkgdesc="Symbol dumper for Firefox"
url="https://github.com/mozilla/dump_syms"
arch=(x86_64)
license=(
  APACHE
  MIT
)
depends=(gcc-libs)
makedepends=(
  cargo
  git
)
options=(!lto)
_commit=fa4caf72ff6ca07c0bbf29cecf693c6294193563  # tags/v2.2.1^0
source=("git+$url#commit=$_commit")
sha512sums=('SKIP')

# Use LTO
export CARGO_PROFILE_RELEASE_LTO=true CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1

# Use debug
export CARGO_PROFILE_RELEASE_DEBUG=2

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^v//;s/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd $pkgname
  cargo fetch --locked --target x86_64-unknown-linux-gnu
}

build() {
  cd $pkgname
  cargo build --release --frozen --all-targets
}

check() {
  cd $pkgname
  cargo test --release --frozen
}

package() {
  cd $pkgname
  install -Dt "$pkgdir/usr/bin" target/release/dump_syms
  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 LICENSE*
}

# vim:set sw=2 sts=-1 et:
